package com.aliyun.heiyu.powermaster.server.rbac.contants;

public interface SafeSqlContant {
    //收集安全审计数据
    String INSERT_SAFE = "INSERT INTO sys_safe_audit(collect_time,event_type,username,ip,event_desc,event_result,del_state,event_state,push,opera_type,menu_url) VALUES(?,?,?,?,?,?,1,?,?,?,?)";

    //根据时间 姓名  状态  分页查询安全设计数据
    String SELECT_SAFES = " SELECT id,collect_time,event_type,username,ip,event_desc,event_result,event_state,opera_type,menu_url FROM sys_safe_audit";

    //查询安全审计的数量
    String SELECT_SAFE_COUNT = "SELECT COUNT(id) count FROM sys_safe_audit WHERE del_state =1";

    //查询需要推送的异常审计信息
    String SELECT_EXCEPTION_BY_STATE = "SELECT id,collect_time,username,event_desc,event_result FROM  sys_safe_audit WHERE push=? AND event_state = ?";


    //查询六月前最旧的一条数据
    String SELECT_SAFE_OLD = "SELECT id FROM sys_safe_audit WHERE collect_time<DATE_ADD(CURDATE(),INTERVAL -6 MONTH) AND del_state = 1 ORDER BY collect_time LIMIT 1";

    //覆盖数据
    String UPDATE_SAFE_BYID = "UPDATE sys_safe_audit SET collect_time = ?, event_type = ?, username = ?, ip = ?, event_desc = ?, event_result = ?, del_state = ?, event_state = ?, push = ? WHERE id = ?";


}
